<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>组件基础</title>
		<script src="https://unpkg.com/vue/dist/vue.js"></script>
	</head>
	<body>
		<div id="app">
			<div id="components-demo">
			  <button-counter></button-counter>
			  <button-counter></button-counter>
			  <button-counter></button-counter>
			</div>
		</div>
		
		<script type="text/javascript">
			// 定义一个名为 button-counter 的新组件
			//一个组件的 data 选项必须是一个函数
			Vue.component('button-counter', {
			  data: function () {
			    return {
			      count: 0
			    }
			  },
			  template: '<button v-on:click="count++">You clicked me {{ count }} times.</button>'
			})
			
			new Vue({
				el:'#app',
				data:{
					
				}
			})
		</script>
	</body>
</html>